
package com.ami.kvm.jviewer.gui;

import com.ami.kvm.jviewer.Debug;
import com.ami.kvm.jviewer.hid.USBKeyProcessorEnglish;
import com.ami.kvm.jviewer.hid.USBKeyboardRep;
import com.ami.kvm.jviewer.kvmpkts.KVMClient;
import java.awt.Font;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Hashtable;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
import javax.swing.event.MouseInputAdapter;

public class SoftKeyboard extends JDialog {
	private JPanel JDialogContentPane;
	public JButton[] m_butKey;
	public JToggleButton[] m_toggleKey;
	private JButton[] japSpecialKeys;
	private static int keycount;
	private USBKeyboardRep keyRep;
	KVMClient m_KVMClnt = JViewerApp.getInstance().getKVMClient();
	private Hashtable<Integer, Integer> m_ps2;
	private static int lngindex;
	SKMouseListener m_skmouselistener;
	public boolean num_Firsttime = true;
	private boolean altGr_enable = false;
	byte clientKybdLED;
	public static boolean Japaneskeyflag = false;
	public static boolean HiraganaPRessed = true;

	private final int WIDTH = 622;
	private final int HEIGHT = 220;

	public static final int NUMLOCK = 1;
	public static final int CAPSLOCK = 2;
	public static final int SCROLLLOCK = 4;
	private static final HashSet<Integer> EXCEPT_LAYOUTS = new HashSet(Arrays.asList(new Integer[] { Integer.valueOf(6),
			Integer.valueOf(21), Integer.valueOf(7), Integer.valueOf(4), Integer.valueOf(9), Integer.valueOf(15),
			Integer.valueOf(11), Integer.valueOf(17), Integer.valueOf(18) }));

	private String[] keylabel = { "esc", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12",
			"psc", "slk", "brk" };

	private String[] modkeys = { "tab", "caps", "shift", "ctrl", "win", "alt", " ", "alt", "win", "ctrl", "shift",
			"ent", "bksp" };

	private String[] otherkeys = { "ins", "hm", "pup", "nlk", "/", "*", "-", "del", "end", "pdn", "^", "<=", "v", "=>",
			"+", "ent" };

	private String numpadkeyson = "7894561230.";

	private String[] numpadkeysoff = { "hm", "up", "pup", "lft", " ", "rgt", "end", "dn", "pdn", "Ins", "Del" };

	private int[] numpadkeysoffevent = { 36, 38, 33, 37, 0, 39, 35, 40, 34, 155, 127 };

	public SoftKeyboard(int paramInt, JFrame paramJFrame) {
		super(paramJFrame, null, false);
		lngindex = paramInt;
		keycount = 63;
		this.m_butKey = new JButton[98];
		this.m_toggleKey = new JToggleButton[11];
		this.japSpecialKeys = new JButton[4];
		this.m_skmouselistener = new SKMouseListener();
		this.keyRep = new USBKeyboardRep();
		this.keyRep.setM_USBKeyProcessor(new USBKeyProcessorEnglish());
		this.keyRep.setAutoKeybreakMode(true);
		this.m_KVMClnt = JViewerApp.getInstance().getKVMClient();
		this.m_ps2 = new Hashtable();
		fillhashtable();
		displaykeypad();
	}

	public static void main(String[] paramArrayOfString) {
	}

	public void fillhashtable() {
		this.m_ps2.put(Integer.valueOf(0), Integer.valueOf(27));
		this.m_ps2.put(Integer.valueOf(1), Integer.valueOf(112));
		this.m_ps2.put(Integer.valueOf(2), Integer.valueOf(113));
		this.m_ps2.put(Integer.valueOf(3), Integer.valueOf(114));
		this.m_ps2.put(Integer.valueOf(4), Integer.valueOf(115));
		this.m_ps2.put(Integer.valueOf(5), Integer.valueOf(116));
		this.m_ps2.put(Integer.valueOf(6), Integer.valueOf(117));
		this.m_ps2.put(Integer.valueOf(7), Integer.valueOf(118));
		this.m_ps2.put(Integer.valueOf(8), Integer.valueOf(119));
		this.m_ps2.put(Integer.valueOf(9), Integer.valueOf(120));
		this.m_ps2.put(Integer.valueOf(10), Integer.valueOf(121));
		this.m_ps2.put(Integer.valueOf(11), Integer.valueOf(122));
		this.m_ps2.put(Integer.valueOf(12), Integer.valueOf(123));
		this.m_ps2.put(Integer.valueOf(13), Integer.valueOf(154));
		this.m_ps2.put(Integer.valueOf(14), Integer.valueOf(145));
		this.m_ps2.put(Integer.valueOf(15), Integer.valueOf(19));
		this.m_ps2.put(Integer.valueOf(16), Integer.valueOf(192));
		this.m_ps2.put(Integer.valueOf(17), Integer.valueOf(49));
		this.m_ps2.put(Integer.valueOf(18), Integer.valueOf(50));
		this.m_ps2.put(Integer.valueOf(19), Integer.valueOf(51));
		this.m_ps2.put(Integer.valueOf(20), Integer.valueOf(52));
		this.m_ps2.put(Integer.valueOf(21), Integer.valueOf(53));
		this.m_ps2.put(Integer.valueOf(22), Integer.valueOf(54));
		this.m_ps2.put(Integer.valueOf(23), Integer.valueOf(55));
		this.m_ps2.put(Integer.valueOf(24), Integer.valueOf(56));
		this.m_ps2.put(Integer.valueOf(25), Integer.valueOf(57));
		this.m_ps2.put(Integer.valueOf(26), Integer.valueOf(48));
		this.m_ps2.put(Integer.valueOf(27), Integer.valueOf(45));
		this.m_ps2.put(Integer.valueOf(28), Integer.valueOf(61));
		this.m_ps2.put(Integer.valueOf(29), Integer.valueOf(81));
		this.m_ps2.put(Integer.valueOf(30), Integer.valueOf(87));
		this.m_ps2.put(Integer.valueOf(31), Integer.valueOf(69));
		this.m_ps2.put(Integer.valueOf(32), Integer.valueOf(82));
		this.m_ps2.put(Integer.valueOf(33), Integer.valueOf(84));
		this.m_ps2.put(Integer.valueOf(34), Integer.valueOf(89));
		this.m_ps2.put(Integer.valueOf(35), Integer.valueOf(85));
		this.m_ps2.put(Integer.valueOf(36), Integer.valueOf(73));
		this.m_ps2.put(Integer.valueOf(37), Integer.valueOf(79));
		this.m_ps2.put(Integer.valueOf(38), Integer.valueOf(80));
		this.m_ps2.put(Integer.valueOf(39), Integer.valueOf(91));
		this.m_ps2.put(Integer.valueOf(40), Integer.valueOf(93));
		this.m_ps2.put(Integer.valueOf(41), Integer.valueOf(92));
		this.m_ps2.put(Integer.valueOf(42), Integer.valueOf(65));
		this.m_ps2.put(Integer.valueOf(43), Integer.valueOf(83));
		this.m_ps2.put(Integer.valueOf(44), Integer.valueOf(68));
		this.m_ps2.put(Integer.valueOf(45), Integer.valueOf(70));
		this.m_ps2.put(Integer.valueOf(46), Integer.valueOf(71));
		this.m_ps2.put(Integer.valueOf(47), Integer.valueOf(72));
		this.m_ps2.put(Integer.valueOf(48), Integer.valueOf(74));
		this.m_ps2.put(Integer.valueOf(49), Integer.valueOf(75));
		this.m_ps2.put(Integer.valueOf(50), Integer.valueOf(76));
		this.m_ps2.put(Integer.valueOf(51), Integer.valueOf(59));
		this.m_ps2.put(Integer.valueOf(52), Integer.valueOf(222));
		this.m_ps2.put(Integer.valueOf(53), Integer.valueOf(226));
		this.m_ps2.put(Integer.valueOf(54), Integer.valueOf(90));
		this.m_ps2.put(Integer.valueOf(55), Integer.valueOf(88));
		this.m_ps2.put(Integer.valueOf(56), Integer.valueOf(67));
		this.m_ps2.put(Integer.valueOf(57), Integer.valueOf(86));
		this.m_ps2.put(Integer.valueOf(58), Integer.valueOf(66));
		this.m_ps2.put(Integer.valueOf(59), Integer.valueOf(78));
		this.m_ps2.put(Integer.valueOf(60), Integer.valueOf(77));
		this.m_ps2.put(Integer.valueOf(61), Integer.valueOf(44));
		this.m_ps2.put(Integer.valueOf(62), Integer.valueOf(46));
		this.m_ps2.put(Integer.valueOf(63), Integer.valueOf(47));
		this.m_ps2.put(Integer.valueOf(64), Integer.valueOf(9));
		this.m_ps2.put(Integer.valueOf(65), Integer.valueOf(20));
		this.m_ps2.put(Integer.valueOf(66), Integer.valueOf(16));
		this.m_ps2.put(Integer.valueOf(67), Integer.valueOf(17));
		this.m_ps2.put(Integer.valueOf(68), Integer.valueOf(524));
		this.m_ps2.put(Integer.valueOf(69), Integer.valueOf(18));
		this.m_ps2.put(Integer.valueOf(70), Integer.valueOf(32));
		this.m_ps2.put(Integer.valueOf(71), Integer.valueOf(18));
		this.m_ps2.put(Integer.valueOf(72), Integer.valueOf(524));
		this.m_ps2.put(Integer.valueOf(73), Integer.valueOf(17));
		this.m_ps2.put(Integer.valueOf(74), Integer.valueOf(16));
		this.m_ps2.put(Integer.valueOf(75), Integer.valueOf(10));
		this.m_ps2.put(Integer.valueOf(76), Integer.valueOf(8));
		this.m_ps2.put(Integer.valueOf(77), Integer.valueOf(155));
		this.m_ps2.put(Integer.valueOf(78), Integer.valueOf(36));
		this.m_ps2.put(Integer.valueOf(79), Integer.valueOf(33));
		this.m_ps2.put(Integer.valueOf(80), Integer.valueOf(144));
		this.m_ps2.put(Integer.valueOf(81), Integer.valueOf(111));
		this.m_ps2.put(Integer.valueOf(82), Integer.valueOf(106));
		this.m_ps2.put(Integer.valueOf(83), Integer.valueOf(109));
		this.m_ps2.put(Integer.valueOf(84), Integer.valueOf(127));
		this.m_ps2.put(Integer.valueOf(85), Integer.valueOf(35));
		this.m_ps2.put(Integer.valueOf(86), Integer.valueOf(34));
		this.m_ps2.put(Integer.valueOf(87), Integer.valueOf(38));
		this.m_ps2.put(Integer.valueOf(88), Integer.valueOf(37));
		this.m_ps2.put(Integer.valueOf(89), Integer.valueOf(40));
		this.m_ps2.put(Integer.valueOf(90), Integer.valueOf(39));
		this.m_ps2.put(Integer.valueOf(91), Integer.valueOf(107));
		this.m_ps2.put(Integer.valueOf(92), Integer.valueOf(10));
		this.m_ps2.put(Integer.valueOf(93), Integer.valueOf(103));
		this.m_ps2.put(Integer.valueOf(94), Integer.valueOf(104));
		this.m_ps2.put(Integer.valueOf(95), Integer.valueOf(105));
		this.m_ps2.put(Integer.valueOf(96), Integer.valueOf(100));
		this.m_ps2.put(Integer.valueOf(97), Integer.valueOf(101));
		this.m_ps2.put(Integer.valueOf(98), Integer.valueOf(102));
		this.m_ps2.put(Integer.valueOf(99), Integer.valueOf(97));
		this.m_ps2.put(Integer.valueOf(100), Integer.valueOf(98));
		this.m_ps2.put(Integer.valueOf(101), Integer.valueOf(99));
		this.m_ps2.put(Integer.valueOf(102), Integer.valueOf(96));
		this.m_ps2.put(Integer.valueOf(103), Integer.valueOf(110));
		this.m_ps2.put(Integer.valueOf(104), Integer.valueOf(999));
	}

	public void displaykeypad() {
		int i5;
		int i4;
		int i3;
		int i2;
		int k;
		int j;
		int m,n,i1;
		int i = j = k = m = n = i1 = i2 = i3 = i4 = i5 = 0;
		Font localFont;
		if (System.getProperty("os.name").equals("Linux")) {
			localFont = new Font("Dialog", 1, 10);
		} else {
			localFont = new Font("Dialog", 1, 12);
		}

		this.JDialogContentPane = new JPanel();
		this.JDialogContentPane.setName("JDialogContentPane");
		this.JDialogContentPane.setLayout(null);

		for (i = 0; i < 64; i++) {
			if (i == 14) {
				this.m_toggleKey[0] = new JToggleButton();
				this.m_toggleKey[0].setName("Key" + i);
				this.m_toggleKey[0].setFont(localFont);
				this.m_toggleKey[0].setText(this.keylabel[i]);
				this.m_toggleKey[0].setBounds(8 + j, 9 + k, 27, 27);
				this.m_toggleKey[0].setMargin(new Insets(0, 0, 0, 0));
				this.m_toggleKey[0].setHorizontalTextPosition(0);
				this.m_toggleKey[0].setVerticalTextPosition(3);
				this.m_toggleKey[0].addMouseListener(this.m_skmouselistener);

				this.m_toggleKey[0].setVisible(true);
				this.JDialogContentPane.add(this.m_toggleKey[0], this.m_toggleKey[0].getName());
				j += 27;
			} else {
				if ((lngindex == 16) || (lngindex == 19) || (lngindex == 20)) {

					if (i < 16) {
						this.m_butKey[i] = new JButton();
						this.m_butKey[i].setName("Key" + i);
						this.m_butKey[i].setFont(localFont);
						this.m_butKey[i].setText(this.keylabel[i]);
					} else {
						if (i == 16) {
							this.japSpecialKeys[3] = new JButton();
							this.japSpecialKeys[3].setName("Key" + i);
							this.japSpecialKeys[3].setText("半/全");
							this.japSpecialKeys[3].setFont(new Font("Dialog", 0, 9));
							this.japSpecialKeys[3].setBounds(8 + j, 9 + k, 27, 27);
							this.japSpecialKeys[3].setMargin(new Insets(0, 0, 0, 0));
							this.japSpecialKeys[3].setHorizontalTextPosition(0);
							this.japSpecialKeys[3].setVerticalTextPosition(3);
							this.japSpecialKeys[3].addMouseListener(this.m_skmouselistener);
							this.japSpecialKeys[3].setVisible(true);
							this.JDialogContentPane.add(this.japSpecialKeys[3], this.japSpecialKeys[3].getName());
							j += 27;
							continue;
						}

						this.m_butKey[i] = new JButton();
						this.m_butKey[i].setName("Key" + i);
						this.m_butKey[i].setFont(localFont);

						this.m_butKey[i].setText(String
								.valueOf(com.ami.kvm.jviewer.hid.KeyProcessor.normalCharSet[lngindex].charAt(i - 17)));
					}

					if ((i > 16) && (i < 29)) {
						if ((lngindex == 16) || (lngindex == 19) || (lngindex == 20)) {
							this.m_butKey[i].setBounds(8 + j, 9 + k, 25, 27);
						} else {
							this.m_butKey[i].setBounds(8 + j, 9 + k, 27, 27);
						}
					} else
						this.m_butKey[i].setBounds(8 + j, 9 + k, 27, 27);
					this.m_butKey[i].setMargin(new Insets(0, 0, 0, 0));
					this.m_butKey[i].setHorizontalTextPosition(0);

					this.m_butKey[i].setVerticalTextPosition(3);
					this.m_butKey[i].addMouseListener(this.m_skmouselistener);
					this.m_butKey[i].setVisible(true);
					this.JDialogContentPane.add(this.m_butKey[i], this.m_butKey[i].getName());
				} else {
					this.m_butKey[i] = new JButton();
					this.m_butKey[i].setName("Key" + i);
					this.m_butKey[i].setFont(localFont);
					if (i < 16) {
						this.m_butKey[i].setText(this.keylabel[i]);
					} else {
						this.m_butKey[i].setText(String
								.valueOf(com.ami.kvm.jviewer.hid.KeyProcessor.normalCharSet[lngindex].charAt(i - 16)));
					}
					this.m_butKey[i].setBounds(8 + j, 9 + k, 27, 27);
					this.m_butKey[i].setMargin(new Insets(0, 0, 0, 0));
					this.m_butKey[i].setHorizontalTextPosition(0);
					this.m_butKey[i].setVerticalTextPosition(3);
					this.m_butKey[i].addMouseListener(this.m_skmouselistener);
					this.m_butKey[i].setVisible(true);
					this.JDialogContentPane.add(this.m_butKey[i], this.m_butKey[i].getName());
				}
				switch (i) {
				case 0:
					j += 43;
					break;
				case 4:
					j += 38;
					break;
				case 8:
					j += 38;
					break;
				case 12:
					j += 38;
					break;
				case 15:
					k += 38;
					j = 0;
					break;
				case 28:
					k += 28;
					j = 38;
					break;
				case 41:
					k += 28;
					j = 46;
					break;
				case 52:
					k += 28;
					j = 32;
					break;
				default:
					if ((i > 16) && (i < 29)) {
						if ((lngindex == 16) || (lngindex == 19) || (lngindex == 20)) {
							j += 25;
						} else {
							j += 27;
						}
					} else {
						j += 27;
					}
					break;
				}

			}
		}
		for (int m1 = 64; m1 < 77; m1++) {

			if ((m1 == 65) || (m1 == 66) || (m1 == 67) || (m1 == 68) || (m1 == 69) || (m1 == 71) || (m1 == 72) || (m1 == 73)
					|| (m1 == 74)) {
				if (m1 >= 71) {
					this.m_toggleKey[(m1 - 65)] = new JToggleButton();
					this.m_toggleKey[(m1 - 65)].setName("Key" + m1);
					this.m_toggleKey[(m1 - 65)].setFont(localFont);
					this.m_toggleKey[(m1 - 65)].setText(this.modkeys[(m1 - 64)]);
				} else {
					this.m_toggleKey[(m1 - 64)] = new JToggleButton();
					this.m_toggleKey[(m1 - 64)].setName("Key" + m1);
					this.m_toggleKey[(m1 - 64)].setFont(localFont);
					this.m_toggleKey[(m1 - 64)].setText(this.modkeys[(m1 - 64)]);
				}
				switch (m1) {
				case 65:
					this.m_toggleKey[(m1 - 64)].setBounds(8, 103, 46, 27);
					break;
				case 66:
					if ((lngindex == 16) || (lngindex == 19) || (lngindex == 20)) {

						this.m_toggleKey[(m1 - 64)].setBounds(8, 131, 59, 27);
					} else
						this.m_toggleKey[(m1 - 64)].setBounds(8, 131, 32, 27);
					break;
				case 67:
					this.m_toggleKey[(m1 - 64)].setBounds(8, 159, 38, 27);
					break;
				case 68:
					this.m_toggleKey[(m1 - 64)].setBounds(46, 159, 27, 27);
					break;
				case 69:
					this.m_toggleKey[(m1 - 64)].setBounds(73, 159, 30, 27);
					break;
				case 71:
					this.m_toggleKey[(m1 - 65)].setBounds(302, 159, 30, 27);
					break;
				case 72:
					this.m_toggleKey[(m1 - 65)].setBounds(332, 159, 27, 27);
					break;
				case 73:
					this.m_toggleKey[(m1 - 65)].setBounds(359, 159, 38, 27);
					break;
				case 74:
					if ((lngindex == 16) || (lngindex == 19) || (lngindex == 20)) {

						this.m_toggleKey[(m1 - 65)].setBounds(364, 131, 33, 27);
					} else
						this.m_toggleKey[(m1 - 65)].setBounds(337, 131, 60, 27);
					break;
				}
				if (m1 >= 70) {
					this.m_toggleKey[(m1 - 65)].setMargin(new Insets(0, 0, 0, 0));
					this.m_toggleKey[(m1 - 65)].setHorizontalTextPosition(0);
					this.m_toggleKey[(m1 - 65)].setVerticalTextPosition(3);
					this.m_toggleKey[(m1 - 65)].addMouseListener(this.m_skmouselistener);
					this.m_toggleKey[(m1 - 65)].setVisible(true);

					this.JDialogContentPane.add(this.m_toggleKey[(m1 - 65)], this.m_toggleKey[(m1 - 65)].getName());
				} else {
					this.m_toggleKey[(m1 - 64)].setMargin(new Insets(0, 0, 0, 0));
					this.m_toggleKey[(m1 - 64)].setHorizontalTextPosition(0);
					this.m_toggleKey[(m1 - 64)].setVerticalTextPosition(3);
					this.m_toggleKey[(m1 - 64)].addMouseListener(this.m_skmouselistener);
					this.m_toggleKey[(m1 - 64)].setVisible(true);
					this.JDialogContentPane.add(this.m_toggleKey[(m1 - 64)], this.m_toggleKey[(m1 - 64)].getName());
				}
			} else {
				keycount += 1;
				this.m_butKey[keycount] = new JButton();
				this.m_butKey[keycount].setName("Key" + m1);
				this.m_butKey[keycount].setFont(localFont);
				this.m_butKey[keycount].setText(this.modkeys[(m1 - 64)]);
				switch (m1) {
				case 64:
					this.m_butKey[keycount].setBounds(8, 75, 38, 27);
					break;
				case 70:
					if ((lngindex == 16) || (lngindex == 19) || (lngindex == 20)) {

						this.m_butKey[keycount].setBounds(153, 159, 55, 27);
					} else
						this.m_butKey[keycount].setBounds(103, 159, 169, 27);
					break;
				case 75:
					this.m_butKey[keycount].setBounds(351, 103, 46, 27);
					break;
				case 76:
					this.m_butKey[keycount].setBounds(359, 47, 38, 27);
				}

				this.m_butKey[keycount].setMargin(new Insets(0, 0, 0, 0));
				this.m_butKey[keycount].setHorizontalTextPosition(0);
				this.m_butKey[keycount].setVerticalTextPosition(3);
				this.m_butKey[keycount].addMouseListener(this.m_skmouselistener);
				this.m_butKey[keycount].setVisible(true);
				this.JDialogContentPane.add(this.m_butKey[keycount], this.m_butKey[keycount].getName());
			}
		}

		for (int n1 = 77; n1 < 93; n1++) {
			if (n1 == 80) {
				this.m_toggleKey[10] = new JToggleButton();
				this.m_toggleKey[10].setName("Key" + n1);
				this.m_toggleKey[10].setFont(localFont);
				this.m_toggleKey[10].setText(this.otherkeys[(n1 - 77)]);
				this.m_toggleKey[10].setBounds(i3 + 408, i2 + 47, 27, 27);
				i3 += 27;
				this.m_toggleKey[10].setMargin(new Insets(0, 0, 0, 0));
				this.m_toggleKey[10].setHorizontalTextPosition(0);
				this.m_toggleKey[10].setVerticalTextPosition(3);
				this.m_toggleKey[10].addMouseListener(this.m_skmouselistener);
				this.m_toggleKey[10].setRolloverEnabled(true);
				this.m_toggleKey[10].setVisible(true);
				this.JDialogContentPane.add(this.m_toggleKey[10], this.m_toggleKey[10].getName());
			} else {
				keycount += 1;
				this.m_butKey[keycount] = new JButton();
				this.m_butKey[keycount].setName("Key" + n1);
				this.m_butKey[keycount].setFont(localFont);
				this.m_butKey[keycount].setText(this.otherkeys[(n1 - 77)]);
				if ((n1 == 91) || (n1 == 92)) {
					this.m_butKey[keycount].setBounds(i3 + 408, i2 + 47, 27, 55);
				} else
					this.m_butKey[keycount].setBounds(i3 + 408, i2 + 47, 27, 27);
				switch (n1) {
				case 79:
					i3 += 38;
					break;
				case 83:
					i3 = 0;
					i2 += 28;
					break;
				case 86:
					i3 = 27;
					i2 += 56;
					break;
				case 87:
					i3 = 0;
					i2 += 28;
					break;
				case 90:
					i3 = 173;
					i2 = 28;
					break;
				case 91:
					i3 = 173;
					i2 += 56;
					break;
				case 80:
				case 81:
				case 82:
				case 84:
				case 85:
				case 88:
				case 89:
				default:
					i3 += 27;
				}

				this.m_butKey[keycount].setMargin(new Insets(0, 0, 0, 0));
				this.m_butKey[keycount].setHorizontalTextPosition(0);
				this.m_butKey[keycount].setVerticalTextPosition(3);
				this.m_butKey[keycount].addMouseListener(this.m_skmouselistener);
				this.m_butKey[keycount].setRolloverEnabled(true);
				this.m_butKey[keycount].setVisible(true);
				this.JDialogContentPane.add(this.m_butKey[keycount], this.m_butKey[keycount].getName());
			}
		}

		for (int i11 = 93; i11 < 104; i11++) {
			keycount += 1;
			this.m_butKey[keycount] = new JButton();
			this.m_butKey[keycount].setName("Key" + i11);
			this.m_butKey[keycount].setFont(localFont);
			if (this.m_toggleKey[10].isSelected() == true) {
				this.m_butKey[keycount].setText(String.valueOf(this.numpadkeyson.charAt(i11 - 93)));
			} else
				this.m_butKey[keycount].setText(this.numpadkeysoff[(i11 - 93)]);
			if (i11 == 102) {
				this.m_butKey[keycount].setBounds(i5 + 500, i4 + 75, 54, 27);
			} else
				this.m_butKey[keycount].setBounds(i5 + 500, i4 + 75, 27, 27);
			switch (i11) {
			case 95:
			case 98:
			case 101:
				i5 = 0;
				i4 += 28;
				break;
			case 102:
				i5 += 54;
				break;
			case 96:
			case 97:
			case 99:
			case 100:
			default:
				i5 += 27;
			}

			this.m_butKey[keycount].setMargin(new Insets(0, 0, 0, 0));
			this.m_butKey[keycount].setHorizontalTextPosition(0);
			this.m_butKey[keycount].setVerticalTextPosition(3);
			this.m_butKey[keycount].addMouseListener(this.m_skmouselistener);
			this.m_butKey[keycount].setRolloverEnabled(true);
			this.m_butKey[keycount].setVisible(true);
			this.JDialogContentPane.add(this.m_butKey[keycount], this.m_butKey[keycount].getName());
		}

		this.m_butKey[97] = new JButton();
		this.m_butKey[97].setName("Key105");
		this.m_butKey[97].setText("CM");
		this.m_butKey[97].setFont(localFont);
		this.m_butKey[97].setMargin(new Insets(0, 0, 0, 0));
		this.m_butKey[97].setHorizontalTextPosition(0);
		this.m_butKey[97].setVerticalTextPosition(3);
		this.m_butKey[97].addMouseListener(this.m_skmouselistener);
		this.m_butKey[97].setRolloverEnabled(true);
		this.m_butKey[97].setVisible(true);
		if ((lngindex == 16) || (lngindex == 19) || (lngindex == 20)) {

			this.m_butKey[97].setBounds(208, 159, 30, 27);
		} else
			this.m_butKey[97].setBounds(272, 159, 30, 27);
		this.JDialogContentPane.add(this.m_butKey[97], this.m_butKey[97].getName());

		switch (lngindex) {
		case 0:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_77_JVM"));
			break;
		case 1:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_78_JVM"));
			break;
		case 2:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_79_JVM"));
			break;
		case 3:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_80_JVM"));
			break;
		case 4:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_81_JVM"));
			break;
		case 5:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_82_JVM"));
			break;
		case 6:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_83_JVM"));
			break;
		case 7:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_84_JVM"));
			break;
		case 8:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_85_JVM"));
			break;
		case 9:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_86_JVM"));
			break;
		case 10:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_87_JVM"));
			break;
		case 11:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_88_JVM"));
			break;
		case 12:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_89_JVM"));
			break;
		case 13:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_90_JVM"));
			break;

		case 14:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_91_JVM"));
			break;

		case 15:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_92_JVM"));
			break;
		case 16:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_139_JVM"));
			break;

		case 17:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_94_JVM"));
			break;
		case 18:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_95_JVM"));
			break;
		case 19:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_140_JVM"));
			break;
		case 20:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_141_JVM"));
			break;
		case 21:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_142_JVM"));
			break;
		default:
			setTitle(LocaleStrings.getString("F_74_JVM") + " - " + LocaleStrings.getString("F_77_JVM"));
		}

		if ((lngindex == 16) || (lngindex == 19) || (lngindex == 20)) {

			this.japSpecialKeys[0] = new JButton();
			this.japSpecialKeys[0].setName("Key125");
			this.japSpecialKeys[0].setMargin(new Insets(0, 0, 0, 0));
			this.japSpecialKeys[0].setHorizontalTextPosition(0);
			this.japSpecialKeys[0].setVerticalTextPosition(3);
			this.japSpecialKeys[0].addMouseListener(this.m_skmouselistener);
			Font localObject = new Font("Dialog", 0, 10);
			this.japSpecialKeys[0].setFont((Font) localObject);
			this.japSpecialKeys[0].setText("変換");
			this.japSpecialKeys[0].setBounds(238, 159, 32, 27);
			this.japSpecialKeys[0].setVisible(true);
			this.JDialogContentPane.add(this.japSpecialKeys[0], this.japSpecialKeys[0].getName());
			keycount = 94;
			this.japSpecialKeys[1] = new JButton();

			this.japSpecialKeys[1].setFont((Font) localObject);
			this.japSpecialKeys[1].setBounds(103, 159, 50, 27);

			this.japSpecialKeys[1].setName("Key124");
			this.japSpecialKeys[1].setText("無変換");
			this.japSpecialKeys[1].setMargin(new Insets(0, 0, 0, 0));

			this.japSpecialKeys[1].addMouseListener(this.m_skmouselistener);
			this.japSpecialKeys[1].setVisible(true);
			this.JDialogContentPane.add(this.japSpecialKeys[1], this.japSpecialKeys[1].getName());
			this.japSpecialKeys[2] = new JButton();
			this.japSpecialKeys[2].setFont((Font) localObject);
			this.japSpecialKeys[2].setBounds(270, 159, 32, 27);
			this.japSpecialKeys[2].setName("Key126");
			this.japSpecialKeys[2].setText("ひ/カ");
			this.japSpecialKeys[2].setMargin(new Insets(0, 0, 0, 0));
			this.japSpecialKeys[2].addMouseListener(this.m_skmouselistener);
			this.japSpecialKeys[2].setVisible(true);
			this.JDialogContentPane.add(this.japSpecialKeys[2], this.japSpecialKeys[2].getName());

			this.m_butKey[64] = new JButton();
			this.m_butKey[64].setName("Key104");
			this.m_butKey[64].setFont(localFont);

			this.m_butKey[64]
					.setText(String.valueOf(com.ami.kvm.jviewer.hid.KeyProcessor.normalCharSet[lngindex].charAt(47)));

			this.m_butKey[64].setBounds(337, 131, 27, 27);
			this.m_butKey[64].setMargin(new Insets(0, 0, 0, 0));
			this.m_butKey[64].setHorizontalTextPosition(0);

			this.m_butKey[64].setVerticalTextPosition(3);
			this.m_butKey[64].addMouseListener(this.m_skmouselistener);
			this.m_butKey[64].setVisible(true);
			this.JDialogContentPane.add(this.m_butKey[64], this.m_butKey[64].getName());
		}

		if ((lngindex == 16) || (lngindex == 19) || (lngindex == 20)) {
			Rectangle localObject = this.m_butKey[28].getBounds();
			((Rectangle) localObject).x += 25;
			this.m_butKey[53].setBounds((Rectangle) localObject);
		}

		syncKbdLED();
		syncHoldKey();

		setContentPane(this.JDialogContentPane);
		setName("SoftKeyboard");

		Object localObject = JViewerApp.getInstance().getPopUpWindowPosition(622, 220);
		setBounds(((Point) localObject).x, ((Point) localObject).y, 622, 220);
		setResizable(false);
		setFocusable(false);
		setFocusableWindowState(false);
		setAlwaysOnTop(true);
		setVisible(true);
		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent paramAnonymousWindowEvent) {
				SoftKeyboard.this.closeSoftKeyboard();
			}
		});
	}

	public void closeSoftKeyboard() {
		this.m_skmouselistener.close();
		dispose();
	}

	class SKMouseListener extends MouseInputAdapter {
		int butid;

		byte[] n_keys = new byte[4];

		SKMouseListener() {
		}

		public void mouseReleased(MouseEvent paramMouseEvent) {
			try {
				Arrays.fill(this.n_keys, (byte) 0);

				Object localObject;
				if (paramMouseEvent.getSource().getClass().getName() == "javax.swing.JButton") {
					localObject = (JButton) paramMouseEvent.getSource();
					this.butid = new Integer(((JButton) localObject).getName().substring(3)).intValue();

					if (this.butid == 105) {
						SoftKeyboard.this.keyRep.set(525, 1, true);
						SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
						SoftKeyboard.this.keyRep.set(525, 1, false);
						SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
						return;
					}

					if (this.butid == 13) {

						SoftKeyboard.this.keyRep.set(154, 1, false);
						SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
					} else if (this.butid == 15) {

						SoftKeyboard.this.keyRep.set(19, 1, true);
						SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
						SoftKeyboard.this.keyRep.set(19, 1, false);
						SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
					} else {
						if ((this.butid >= 93) && (this.butid <= 103)
								&& (SoftKeyboard.this.m_toggleKey[10].isSelected() == true)) {
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 4,
									true);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 4,
									false);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
						} else {
							int i;
							if ((this.butid >= 93) && (this.butid <= 103)
									&& (!SoftKeyboard.this.m_toggleKey[10].isSelected())) {
								i = this.butid - 93;
								int j = SoftKeyboard.this.numpadkeysoffevent[i];
								SoftKeyboard.this.keyRep.set(j, 4, true);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								SoftKeyboard.this.keyRep.set(j, 4, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							} else if ((this.butid != 64) && (this.butid != 0)) {

								if (this.butid == 53) {
									i = ((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue();
									if ((SoftKeyboard.lngindex == 16) || (SoftKeyboard.lngindex == 19)
											|| (SoftKeyboard.lngindex == 20)) {

										i = 220;
									}
									SoftKeyboard.this.keyRep.set(i, 1, true);

									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
									SoftKeyboard.this.keyRep.set(i, 1, false);

									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);

								} else if (this.butid == 28) {
									SoftKeyboard.this.keyRep.set(61, 1, true);

									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
									SoftKeyboard.this.keyRep.set(61, 1, false);

									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								} else if (this.butid == 52) {
									SoftKeyboard.this.keyRep.set(222, 1, true);

									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
									SoftKeyboard.this.keyRep.set(222, 1, false);

									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								} else if ((this.butid == 81) || (this.butid == 82) || (this.butid == 83)
										|| (this.butid == 91)) {
									SoftKeyboard.this.keyRep
											.set(((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid)))
													.intValue(), 4, true);

									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
									SoftKeyboard.this.keyRep
											.set(((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid)))
													.intValue(), 4, false);
									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								} else if (this.butid == 104) {
									SoftKeyboard.this.keyRep
											.set(((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid)))
													.intValue(), 1, true);

									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
									SoftKeyboard.this.keyRep
											.set(((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid)))
													.intValue(), 1, false);
									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								} else {
									SoftKeyboard.this.keyRep
											.set(((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid)))
													.intValue(), 1, true);
									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
									SoftKeyboard.this.keyRep
											.set(((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid)))
													.intValue(), 1, false);
									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								}
							} else if (this.butid == 64) {
								SoftKeyboard.this.keyRep.set(9, 1, true);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								SoftKeyboard.this.keyRep.set(9, 1, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							} else if (this.butid == 0) {

								SoftKeyboard.this.keyRep.set(27, 1, true);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								SoftKeyboard.this.keyRep.set(27, 1, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							}
						}
						if (SoftKeyboard.this.m_toggleKey[6].isSelected() == true) {
							if (JViewerApp.getInstance().getM_wndFrame().getM_status().getRightAlt()
									.isSelected() == true) {
								if ((SoftKeyboard.lngindex != 0) && (SoftKeyboard.lngindex != 15)
										&& (SoftKeyboard.lngindex != 16) && (SoftKeyboard.lngindex != 19)
										&& (SoftKeyboard.lngindex != 20)) {

									SoftKeyboard.this.altGr_enable = true;
									OnAltGrOn(com.ami.kvm.jviewer.hid.KeyProcessor.altGrCharSet[SoftKeyboard.lngindex]);
								}
								SoftKeyboard.this.m_toggleKey[6].setSelected(true);
								OnModifier(18, 3, 401);

							} else if ((this.butid <= 76) && (this.butid != 14) && (this.butid != 65)
									&& (this.butid != 66) && (this.butid != 67) && (this.butid != 68)
									&& (this.butid != 69) && (this.butid != 72) && (this.butid != 73)
									&& (this.butid != 74)) {

								OnRightAltRelease();
								SoftKeyboard.this.m_toggleKey[6].setSelected(false);
								OnModifier(18, 3, 402);
							}
						}

						if ((this.butid <= 64) || ((this.butid == 104) && (this.butid != 13) && (this.butid != 14))) {
							if ((SoftKeyboard.this.m_toggleKey[2].isSelected() == true)
									&& ((this.butid != 64) || ((SoftKeyboard.this.m_toggleKey[5].isSelected() != true)
											&& (SoftKeyboard.this.m_toggleKey[6].isSelected() != true)))) {

								this.butid = new Integer(SoftKeyboard.this.m_toggleKey[2].getName().substring(3))
										.intValue();
								SoftKeyboard.this.keyRep.set(
										((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(),
										2, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								if (SoftKeyboard.this.m_toggleKey[1].isSelected() == true) {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCapsCharSet[SoftKeyboard.lngindex]);

								} else {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCharSet[SoftKeyboard.lngindex]);
								}
								SoftKeyboard.this.m_toggleKey[2].setSelected(false);
								SoftKeyboard.this.m_toggleKey[9].setSelected(false);
							}

							if ((SoftKeyboard.this.m_toggleKey[9].isSelected() == true)
									&& ((this.butid != 64) || ((SoftKeyboard.this.m_toggleKey[5].isSelected() != true)
											&& (SoftKeyboard.this.m_toggleKey[6].isSelected() != true)))) {

								this.butid = new Integer(SoftKeyboard.this.m_toggleKey[2].getName().substring(3))
										.intValue();
								SoftKeyboard.this.keyRep.set(
										((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(),
										3, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								if (SoftKeyboard.this.m_toggleKey[1].isSelected() == true) {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCapsCharSet[SoftKeyboard.lngindex]);

								} else {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCharSet[SoftKeyboard.lngindex]);
								}
								SoftKeyboard.this.m_toggleKey[2].setSelected(false);
								SoftKeyboard.this.m_toggleKey[9].setSelected(false);
							}

							if ((SoftKeyboard.this.m_toggleKey[5].isSelected() == true) && (this.butid != 64)
									&& (this.butid != 0)) {
								if (JViewerApp.getInstance().getM_wndFrame().getM_status().getLeftAlt()
										.isSelected() == true) {
									OnModifier(18, 2, 401);

								} else {

									OnModifier(18, 2, 402);

									SoftKeyboard.this.m_toggleKey[5].setSelected(false);
								}
							}

							if ((SoftKeyboard.this.m_toggleKey[6].isSelected() == true) && (this.butid != 64)
									&& (this.butid != 0)) {
								if (JViewerApp.getInstance().getM_wndFrame().getM_status().getRightAlt()
										.isSelected() == true) {
									if ((SoftKeyboard.lngindex != 0) && (SoftKeyboard.lngindex != 15)
											&& (SoftKeyboard.lngindex != 16) && (SoftKeyboard.lngindex != 19)
											&& (SoftKeyboard.lngindex != 20)) {

										SoftKeyboard.this.altGr_enable = true;
										OnAltGrOn(
												com.ami.kvm.jviewer.hid.KeyProcessor.altGrCharSet[SoftKeyboard.lngindex]);
									}
									OnModifier(18, 3, 401);

								} else {
									OnModifier(18, 3, 402);

									SoftKeyboard.this.m_toggleKey[6].setSelected(false);
								}
							}

							if (SoftKeyboard.this.m_toggleKey[3].isSelected() == true) {
								if (JViewerApp.getInstance().getM_wndFrame().getM_status().getLeftCtrl()
										.isSelected() == true) {
									this.butid = new Integer(SoftKeyboard.this.m_toggleKey[3].getName().substring(3))
											.intValue();
									SoftKeyboard.this.keyRep
											.set(((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid)))
													.intValue(), 2, true);
									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);

								} else {
									this.butid = new Integer(SoftKeyboard.this.m_toggleKey[3].getName().substring(3))
											.intValue();
									SoftKeyboard.this.keyRep
											.set(((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid)))
													.intValue(), 2, false);
									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
									SoftKeyboard.this.m_toggleKey[3].setSelected(false);
								}
							}

							if (SoftKeyboard.this.m_toggleKey[8].isSelected() == true) {
								if (JViewerApp.getInstance().getM_wndFrame().getM_status().getRightCtrl()
										.isSelected() == true) {
									this.butid = new Integer(SoftKeyboard.this.m_toggleKey[8].getName().substring(3))
											.intValue();
									SoftKeyboard.this.keyRep
											.set(((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid)))
													.intValue(), 3, true);
									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);

								} else {
									this.butid = new Integer(SoftKeyboard.this.m_toggleKey[8].getName().substring(3))
											.intValue();
									SoftKeyboard.this.keyRep
											.set(((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid)))
													.intValue(), 3, false);
									SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
									SoftKeyboard.this.m_toggleKey[8].setSelected(false);
								}

							}
						}
					}
				} else {
					localObject = (JToggleButton) paramMouseEvent.getSource();
					this.butid = new Integer(((JToggleButton) localObject).getName().substring(3)).intValue();

					if (((JToggleButton) localObject).isSelected() == true) {
						if ((SoftKeyboard.lngindex == 16) || (SoftKeyboard.lngindex == 19)
								|| (SoftKeyboard.lngindex == 20)) {

							if (this.butid == 16) {
								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(192, 1, true);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(192, 1, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								return;
							}
							if (this.butid == 124) {
								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(29, 1, true);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(29, 1, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);

								if ((SoftKeyboard.this.m_toggleKey[1].isSelected())
										&& ((JViewerApp.getInstance().getHostKeyboardLEDStatus() & 0x2) == 2)) {
									if ((JViewerApp.getInstance().getHostKeyboardLEDStatus() & 0x2) == 2) {
										if (!SoftKeyboard.this.m_toggleKey[6].isSelected()) {
											if ((SoftKeyboard.this.m_toggleKey[2].isSelected() == true)
													|| (SoftKeyboard.this.m_toggleKey[9].isSelected() == true)) {
												OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.shiftedCapsCharSet[SoftKeyboard.lngindex]);
											} else {
												OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCapsCharSet[SoftKeyboard.lngindex]);
												SoftKeyboard.this.m_butKey[15].setText("pau");
											}

										}
									} else if (!SoftKeyboard.this.m_toggleKey[6].isSelected()) {
										if ((SoftKeyboard.this.m_toggleKey[2].isSelected() == true)
												|| (SoftKeyboard.this.m_toggleKey[9].isSelected() == true)) {
											OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.shiftedCharSet[SoftKeyboard.lngindex]);
										} else {
											OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCharSet[SoftKeyboard.lngindex]);
											SoftKeyboard.this.m_butKey[15].setText("brk");
										}

									}

								} else if (!SoftKeyboard.this.m_toggleKey[6].isSelected()) {
									if ((SoftKeyboard.this.m_toggleKey[2].isSelected() == true)
											|| (SoftKeyboard.this.m_toggleKey[9].isSelected() == true)) {
										OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.shiftedCharSet[SoftKeyboard.lngindex]);
									} else {
										OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCharSet[SoftKeyboard.lngindex]);
										SoftKeyboard.this.m_butKey[15].setText("brk");
									}
								}

								return;
							}

							if (this.butid == 125) {
								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(28, 1, true);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(28, 1, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								return;
							}

							if (this.butid == 126) {

								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(240, 1, true);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(240, 1, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								return;
							}
						}

						switch (this.butid) {
						case 68:
							SoftKeyboard.this.m_toggleKey[4].setSelected(true);
							SoftKeyboard.this.keyRep.set(524, 2, true);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							break;
						case 72:
							SoftKeyboard.this.m_toggleKey[7].setSelected(true);
							SoftKeyboard.this.keyRep.set(524, 3, true);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							break;
						case 65:
							if (!SoftKeyboard.this.m_toggleKey[6].isSelected()) {
								if ((SoftKeyboard.this.m_toggleKey[2].isSelected() == true)
										|| (SoftKeyboard.this.m_toggleKey[9].isSelected() == true)) {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.shiftedCapsCharSet[SoftKeyboard.lngindex]);
								} else {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCapsCharSet[SoftKeyboard.lngindex]);
								}
							}
							SoftKeyboard.this.m_butKey[15].setText("pau");
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 1,
									true);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 1,
									false);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							break;

						case 80:
							OnNum(SoftKeyboard.this.numpadkeyson);
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 4,
									true);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 4,
									false);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							break;
						case 14:
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 1,
									true);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 1,
									false);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							break;
						case 66:
							if (!SoftKeyboard.this.m_toggleKey[6].isSelected()) {
								SoftKeyboard.this.m_toggleKey[9].setSelected(true);
								if (SoftKeyboard.this.m_toggleKey[1].isSelected() == true) {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.shiftedCapsCharSet[SoftKeyboard.lngindex]);
								} else {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.shiftedCharSet[SoftKeyboard.lngindex]);
									SoftKeyboard.this.m_butKey[15].setText("pau");
								}

							} else if ((SoftKeyboard.lngindex == 17) || (SoftKeyboard.lngindex == 18)) {
								OnAltGrOn(
										com.ami.kvm.jviewer.hid.KeyProcessor.shiftedAltGrCharSet[SoftKeyboard.lngindex]);
							}

							SoftKeyboard.this.keyRep.set(16, 2, true);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							break;

						case 74:
							if (!SoftKeyboard.this.m_toggleKey[6].isSelected()) {
								SoftKeyboard.this.m_toggleKey[2].setSelected(true);
								if (SoftKeyboard.this.m_toggleKey[1].isSelected() == true) {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.shiftedCapsCharSet[SoftKeyboard.lngindex]);
								} else {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.shiftedCharSet[SoftKeyboard.lngindex]);
									SoftKeyboard.this.m_butKey[15].setText("pau");
								}

							} else if ((SoftKeyboard.lngindex == 17) || (SoftKeyboard.lngindex == 18)) {
								OnAltGrOn(
										com.ami.kvm.jviewer.hid.KeyProcessor.shiftedAltGrCharSet[SoftKeyboard.lngindex]);
							}

							SoftKeyboard.this.keyRep.set(16, 2, true);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);

							break;

						case 69:
							SoftKeyboard.this.keyRep.set(18, 2, true);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);

							break;
						case 71:
							if ((SoftKeyboard.lngindex != 0) && (SoftKeyboard.lngindex != 15)
									&& (SoftKeyboard.lngindex != 16) && (SoftKeyboard.lngindex != 19)
									&& (SoftKeyboard.lngindex != 20)) {

								SoftKeyboard.this.altGr_enable = true;
								if ((SoftKeyboard.this.m_toggleKey[2].isSelected() == true)
										|| (SoftKeyboard.this.m_toggleKey[9].isSelected() == true)) {
									OnAltGrOn(
											com.ami.kvm.jviewer.hid.KeyProcessor.shiftedAltGrCharSet[SoftKeyboard.lngindex]);
								} else {
									OnAltGrOn(com.ami.kvm.jviewer.hid.KeyProcessor.altGrCharSet[SoftKeyboard.lngindex]);
								}
							}

							OnModifier(18, 3, 401);

							break;
						case 67:
							SoftKeyboard.this.m_toggleKey[3].setSelected(true);
							this.butid = new Integer(SoftKeyboard.this.m_toggleKey[3].getName().substring(3))
									.intValue();
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 2,
									true);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							break;
						case 73:
							SoftKeyboard.this.m_toggleKey[8].setSelected(true);
							this.butid = new Integer(SoftKeyboard.this.m_toggleKey[8].getName().substring(3))
									.intValue();
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 3,
									true);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							break;
						default:
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 1,
									true);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							break;
						}
					} else {
						if ((SoftKeyboard.lngindex == 16) || (SoftKeyboard.lngindex == 19)
								|| (SoftKeyboard.lngindex == 20)) {

							if (this.butid == 16) {
								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(192, 1, true);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(192, 1, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								return;
							}
							if (this.butid == 126) {

								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(240, 1, true);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(240, 1, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);

								return;
							}

							if (this.butid == 125) {
								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(28, 1, true);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(28, 1, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
								return;
							}
							if (this.butid == 124) {
								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(29, 1, true);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);

								SoftKeyboard.Japaneskeyflag = true;
								SoftKeyboard.this.keyRep.set(29, 1, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);

								return;
							}
						}

						switch (this.butid) {
						case 68:
							if (JViewerApp.getInstance().getMainWindow().getMenu()
									.getMenuItem("KeyboardLeftWindowsKeyHoldDown").isSelected()) {
								SoftKeyboard.this.m_toggleKey[4].setSelected(true);
								SoftKeyboard.this.keyRep.set(524, 2, true);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							} else {
								SoftKeyboard.this.m_toggleKey[4].setSelected(false);
								SoftKeyboard.this.keyRep.set(524, 2, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							}
							break;
						case 72:
							if (JViewerApp.getInstance().getMainWindow().getMenu()
									.getMenuItem("KeyboardRightWindowsKeyHoldDown").isSelected()) {
								SoftKeyboard.this.m_toggleKey[7].setSelected(true);
								SoftKeyboard.this.keyRep.set(524, 3, true);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							} else {
								SoftKeyboard.this.m_toggleKey[7].setSelected(false);
								SoftKeyboard.this.keyRep.set(524, 3, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							}
							break;
						case 65:
							if (!SoftKeyboard.this.m_toggleKey[6].isSelected()) {
								if ((SoftKeyboard.this.m_toggleKey[2].isSelected() == true)
										|| (SoftKeyboard.this.m_toggleKey[9].isSelected() == true)) {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.shiftedCharSet[SoftKeyboard.lngindex]);
								} else {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCharSet[SoftKeyboard.lngindex]);
								}
							}
							SoftKeyboard.this.m_butKey[15].setText("brk");
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 1,
									true);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 1,
									false);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							break;
						case 80:
							OnNum(SoftKeyboard.this.numpadkeysoff);
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 4,
									true);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 4,
									false);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							break;
						case 14:
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 1,
									true);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 1,
									false);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							break;
						case 66:
							if (!SoftKeyboard.this.m_toggleKey[6].isSelected()) {
								SoftKeyboard.this.m_toggleKey[9].setSelected(false);
								if (SoftKeyboard.this.m_toggleKey[1].isSelected() == true) {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCapsCharSet[SoftKeyboard.lngindex]);
								} else {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCharSet[SoftKeyboard.lngindex]);
									SoftKeyboard.this.m_butKey[15].setText("brk");
								}
							} else {
								OnAltGrOn(com.ami.kvm.jviewer.hid.KeyProcessor.altGrCharSet[SoftKeyboard.lngindex]);
							}

							SoftKeyboard.this.keyRep.set(16, 2, false);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							break;

						case 74:
							if (!SoftKeyboard.this.m_toggleKey[6].isSelected()) {
								SoftKeyboard.this.m_toggleKey[2].setSelected(false);
								if (SoftKeyboard.this.m_toggleKey[1].isSelected() == true) {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCapsCharSet[SoftKeyboard.lngindex]);
								} else {
									OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCharSet[SoftKeyboard.lngindex]);
									SoftKeyboard.this.m_butKey[15].setText("brk");
								}
							} else {
								OnAltGrOn(com.ami.kvm.jviewer.hid.KeyProcessor.altGrCharSet[SoftKeyboard.lngindex]);
							}

							SoftKeyboard.this.keyRep.set(16, 2, false);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							break;
						case 69:
							if (!JViewerApp.getInstance().getM_wndFrame().getM_status().getLeftAlt().isSelected()) {
								OnModifier(18, 2, 402);

							} else {

								OnModifier(18, 2, 401);

								SoftKeyboard.this.m_toggleKey[5].setSelected(true);
							}
							break;
						case 71:
							if (JViewerApp.getInstance().getM_wndFrame().getM_status().getRightAlt()
									.isSelected() == true) {
								if ((SoftKeyboard.lngindex != 0) && (SoftKeyboard.lngindex != 15)
										&& (SoftKeyboard.lngindex != 16) && (SoftKeyboard.lngindex != 19)
										&& (SoftKeyboard.lngindex != 20)) {

									SoftKeyboard.this.altGr_enable = true;
									OnAltGrOn(com.ami.kvm.jviewer.hid.KeyProcessor.altGrCharSet[SoftKeyboard.lngindex]);
								}

								SoftKeyboard.this.m_toggleKey[6].setSelected(true);
								OnModifier(18, 3, 401);

							} else {

								if (SoftKeyboard.lngindex != 16)
									OnRightAltRelease();
								OnModifier(18, 3, 402);
							}

							break;
						case 67:
							if (JViewerApp.getInstance().getM_wndFrame().getM_status().getLeftCtrl()
									.isSelected() == true) {
								SoftKeyboard.this.m_toggleKey[3].setSelected(true);
								this.butid = new Integer(SoftKeyboard.this.m_toggleKey[3].getName().substring(3))
										.intValue();
								SoftKeyboard.this.keyRep.set(
										((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(),
										2, true);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							} else {
								SoftKeyboard.this.m_toggleKey[3].setSelected(false);
								this.butid = new Integer(SoftKeyboard.this.m_toggleKey[3].getName().substring(3))
										.intValue();
								SoftKeyboard.this.keyRep.set(
										((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(),
										2, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							}
							break;
						case 73:
							if (JViewerApp.getInstance().getM_wndFrame().getM_status().getRightCtrl()
									.isSelected() == true) {
								SoftKeyboard.this.m_toggleKey[8].setSelected(true);
								this.butid = new Integer(SoftKeyboard.this.m_toggleKey[8].getName().substring(3))
										.intValue();
								SoftKeyboard.this.keyRep.set(
										((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(),
										3, true);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							} else {
								SoftKeyboard.this.m_toggleKey[8].setSelected(false);
								this.butid = new Integer(SoftKeyboard.this.m_toggleKey[8].getName().substring(3))
										.intValue();
								SoftKeyboard.this.keyRep.set(
										((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(),
										3, false);
								SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
							}
							break;
						default:
							SoftKeyboard.this.keyRep.set(
									((Integer) SoftKeyboard.this.m_ps2.get(Integer.valueOf(this.butid))).intValue(), 1,
									false);
							SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
						}
					}
				}
			} catch (Exception localException) {
				Debug.out.println(localException);
			}
		}

		public void OnPrintScreen() {
			Arrays.fill(this.n_keys, (byte) 0);
			this.n_keys[0] = 1;
			this.n_keys[1] = -32;
			this.n_keys[2] = 18;
			this.n_keys[3] = 0;

			Arrays.fill(this.n_keys, (byte) 0);
			this.n_keys[0] = 1;
			this.n_keys[1] = -32;
			this.n_keys[2] = 124;
			this.n_keys[3] = 0;

			Arrays.fill(this.n_keys, (byte) 0);
			this.n_keys[0] = 2;
			this.n_keys[1] = -32;
			this.n_keys[2] = -16;
			this.n_keys[3] = 124;

			Arrays.fill(this.n_keys, (byte) 0);
			this.n_keys[0] = 2;
			this.n_keys[1] = -32;
			this.n_keys[2] = -16;
			this.n_keys[3] = 18;
		}

		public void OnPause() {
			Arrays.fill(this.n_keys, (byte) 0);
			this.n_keys[0] = 14;
			this.n_keys[1] = 119;
			this.n_keys[2] = -31;
			this.n_keys[3] = -16;
		}

		public void OnModifier(int paramInt1, int paramInt2, int paramInt3) {
			if (401 == paramInt3) {
				SoftKeyboard.this.keyRep.set(paramInt1, paramInt2, true);
			}
			if (402 == paramInt3) {
				SoftKeyboard.this.keyRep.set(paramInt1, paramInt2, false);
			}
			SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
		}

		public void OnRightAltRelease() {
			if (SoftKeyboard.lngindex > 0) {
				if (SoftKeyboard.this.m_toggleKey[1].isSelected() == true) {
					if ((SoftKeyboard.this.m_toggleKey[2].isSelected() == true)
							|| (SoftKeyboard.this.m_toggleKey[9].isSelected() == true)) {
						OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.shiftedCapsCharSet[SoftKeyboard.lngindex]);
					} else
						OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCapsCharSet[SoftKeyboard.lngindex]);
				} else if ((SoftKeyboard.this.m_toggleKey[2].isSelected() == true)
						|| (SoftKeyboard.this.m_toggleKey[9].isSelected() == true)) {
					OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.shiftedCharSet[SoftKeyboard.lngindex]);
				} else
					OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCharSet[SoftKeyboard.lngindex]);
				AltGrOff();
			}
		}

		public void OnEsc() {
			Arrays.fill(this.n_keys, (byte) 0);
			this.n_keys[0] = 0;
			this.n_keys[1] = 118;
			this.n_keys[2] = 0;
			this.n_keys[3] = 0;

			Arrays.fill(this.n_keys, (byte) 0);
			this.n_keys[0] = 2;
			this.n_keys[1] = -16;
			this.n_keys[2] = 118;
			this.n_keys[3] = 0;
		}

		public void OnTab() {
			Arrays.fill(this.n_keys, (byte) 0);
			this.n_keys[0] = 0;
			this.n_keys[1] = 13;
			this.n_keys[2] = 0;
			this.n_keys[3] = 0;

			Arrays.fill(this.n_keys, (byte) 0);
			this.n_keys[0] = 2;
			this.n_keys[1] = -16;
			this.n_keys[2] = 13;
			this.n_keys[3] = 0;
		}

		public void OnCaps(String paramString) {
			int i = 0;

			int k = 16;
			i = 16;
			int j = 64;
			if ((SoftKeyboard.lngindex == 16) || (SoftKeyboard.lngindex == 19) || (SoftKeyboard.lngindex == 20)) {

				i = 17;
				j = 65;
				k = 17;
			}
			try {
				if (SoftKeyboard.lngindex == 3) {
					if ((SoftKeyboard.this.m_toggleKey[2].isSelected() == true)
							|| (SoftKeyboard.this.m_toggleKey[9].isSelected() == true)) {
						SoftKeyboard.this.m_butKey[i].setText(" ");
						i = 17;
						k = 17;
					}
				}
				for (; i < j; i++) {
					if ((SoftKeyboard.this.m_butKey[i].getName().equals("Key" + i))
							|| (SoftKeyboard.this.m_butKey[i].getName().equals("Key104"))) {
						SoftKeyboard.this.m_butKey[i].setText(String.valueOf(paramString.charAt(i - k)));
						SoftKeyboard.this.m_butKey[i].setVisible(true);
						SoftKeyboard.this.JDialogContentPane.repaint();
					}
				}
			} catch (Exception localException) {
				Debug.out.println(localException);
			}
			SoftKeyboard.this.JDialogContentPane.repaint();
		}

		public void OnJapShift(String paramString) {
			for (int i = 17; i < 64; i++) {
				if (SoftKeyboard.this.m_butKey[i].getName().equals("Key" + i)) {
					SoftKeyboard.this.m_butKey[i].setText(String.valueOf(paramString.charAt(i - 16)));
					SoftKeyboard.this.m_butKey[i].setVisible(true);
					SoftKeyboard.this.JDialogContentPane.repaint();
				}
			}
			SoftKeyboard.this.JDialogContentPane.repaint();
		}

		public void OnNum(String paramString) {
			for (int i = 83; i <= 93; i++) {
				if (i == 93) {

					if (SoftKeyboard.EXCEPT_LAYOUTS.contains(Integer.valueOf(SoftKeyboard.lngindex))) {
						SoftKeyboard.this.m_butKey[i].setText(",");
						continue;
					}
				}
				SoftKeyboard.this.m_butKey[i].setText(String.valueOf(paramString.charAt(i - 83)));
			}
		}

		public void OnNum(String[] paramArrayOfString) {
			for (int i = 83; i <= 93; i++) {
				SoftKeyboard.this.m_butKey[i].setText(paramArrayOfString[(i - 83)]);
			}
		}

		public void OnAltGrOn(String paramString) {
			for (int i = 15; i <= 63; i++) {
				SoftKeyboard.this.m_butKey[i].setText(" ");
			}
			for (int i = 64; i <= 74; i++) {
				switch (i) {
				case 64:
					SoftKeyboard.this.m_butKey[64].setText("tab");
					break;
				case 65:
					SoftKeyboard.this.m_toggleKey[1].setText(" ");
					break;
				case 66:
					SoftKeyboard.this.m_toggleKey[2].setText(" ");
					break;
				case 67:
					SoftKeyboard.this.m_toggleKey[3].setText(" ");
					break;
				case 69:
					SoftKeyboard.this.m_toggleKey[5].setText(" ");
					break;
				case 72:
					SoftKeyboard.this.m_toggleKey[8].setText(" ");
					break;
				case 73:
					SoftKeyboard.this.m_toggleKey[9].setText(" ");
					break;
				case 74:
					SoftKeyboard.this.m_butKey[65].setText(" ");
				}

			}
			int j;
			if ((SoftKeyboard.this.m_toggleKey[2].isSelected() == true)
					|| (SoftKeyboard.this.m_toggleKey[9].isSelected() == true)) {
				for (int i = 0; i < com.ami.kvm.jviewer.hid.KeyProcessor.shiftedAltGrIndex[SoftKeyboard.lngindex].length; i++) {
					j = new Integer(com.ami.kvm.jviewer.hid.KeyProcessor.shiftedAltGrIndex[SoftKeyboard.lngindex][i])
							.intValue();
					if (j >= 0) {
						SoftKeyboard.this.m_butKey[j].setText(String.valueOf(paramString.charAt(i)));
					}
				}
			} else {
				for (int i = 0; i < com.ami.kvm.jviewer.hid.KeyProcessor.altGrIndex[SoftKeyboard.lngindex].length; i++) {
					j = new Integer(com.ami.kvm.jviewer.hid.KeyProcessor.altGrIndex[SoftKeyboard.lngindex][i])
							.intValue();
					if (j >= 0)
						SoftKeyboard.this.m_butKey[j].setText(String.valueOf(paramString.charAt(i)));
				}
			}
		}

		public void AltGrOff() {
			SoftKeyboard.this.m_butKey[15].setText("brk");
			SoftKeyboard.this.m_toggleKey[1].setText("caps");
			SoftKeyboard.this.m_toggleKey[2].setText("shift");
			SoftKeyboard.this.m_toggleKey[3].setText("ctrl");
			SoftKeyboard.this.m_toggleKey[5].setText("alt");
			SoftKeyboard.this.m_toggleKey[8].setText("ctrl");
			SoftKeyboard.this.m_toggleKey[9].setText("shift");
			SoftKeyboard.this.m_butKey[66].setText("ent");
		}

		public void close() {
			try {
				if ((SoftKeyboard.this.m_toggleKey[2].isSelected() == true)
						|| (SoftKeyboard.this.m_toggleKey[9].isSelected() == true)) {
					SoftKeyboard.this.keyRep.set(16, 2, false);
					SoftKeyboard.this.m_KVMClnt.sendKMMessage(SoftKeyboard.this.keyRep);
				}
				if (SoftKeyboard.this.m_toggleKey[3].isSelected() == true) {
					OnModifier(17, 2, 402);
				}

				if (SoftKeyboard.this.m_toggleKey[8].isSelected() == true) {
					OnModifier(17, 3, 402);
				}

				if (SoftKeyboard.this.m_toggleKey[4].isSelected() == true) {
					OnModifier(524, 2, 402);
				}
				if (SoftKeyboard.this.m_toggleKey[5].isSelected() == true) {
					OnModifier(18, 2, 402);
				}
				if (SoftKeyboard.this.m_toggleKey[6].isSelected() == true) {
					OnModifier(18, 3, 402);
				}
				if (SoftKeyboard.this.m_toggleKey[7].isSelected() == true) {
					OnModifier(524, 3, 402);
				}
			} catch (Exception localException) {
				Debug.out.println(localException);
			}
		}
	}

	public int getLngindex() {
		return lngindex;
	}

	public void setLngindex(int paramInt) {
		lngindex = paramInt;
	}

	public void syncHoldKey() {
		if (!JViewerApp.getInstance().getM_wndFrame().getM_status().getLeftCtrl().isSelected()) {
			this.m_toggleKey[3].setSelected(false);
		} else {
			this.m_toggleKey[3].setSelected(true);
		}

		if (!JViewerApp.getInstance().getM_wndFrame().getM_status().getRightCtrl().isSelected()) {
			this.m_toggleKey[8].setSelected(false);
		} else {
			this.m_toggleKey[8].setSelected(true);
		}

		if (!JViewerApp.getInstance().getM_wndFrame().getM_status().getLeftAlt().isSelected()) {
			this.m_toggleKey[5].setSelected(false);
		} else {
			this.m_toggleKey[5].setSelected(true);
		}

		if (!JViewerApp.getInstance().getM_wndFrame().getM_status().getRightAlt().isSelected()) {
			if (lngindex != 16)
				this.m_skmouselistener.OnRightAltRelease();
			this.m_skmouselistener.OnModifier(18, 3, 402);

			this.m_toggleKey[6].setSelected(false);
		} else {
			if ((lngindex != 0) && (lngindex != 15) && (lngindex != 16) && (lngindex != 19) && (lngindex != 20)) {

				this.altGr_enable = true;
				if ((this.m_toggleKey[2].isSelected() == true) || (this.m_toggleKey[9].isSelected() == true)) {
					this.m_skmouselistener
							.OnAltGrOn(com.ami.kvm.jviewer.hid.KeyProcessor.shiftedAltGrCharSet[lngindex]);
				} else {
					this.m_skmouselistener.OnAltGrOn(com.ami.kvm.jviewer.hid.KeyProcessor.altGrCharSet[lngindex]);
				}
			}

			this.m_toggleKey[6].setSelected(true);
			this.m_skmouselistener.OnModifier(18, 3, 401);
		}

		if (JViewerApp.getInstance().getMainWindow().getMenu().getMenuItem("KeyboardLeftWindowsKeyHoldDown")
				.isSelected()) {
			this.m_toggleKey[4].setSelected(true);
		} else {
			this.m_toggleKey[4].setSelected(false);
		}

		if (JViewerApp.getInstance().getMainWindow().getMenu().getMenuItem("KeyboardRightWindowsKeyHoldDown")
				.isSelected()) {
			this.m_toggleKey[7].setSelected(true);
		} else {
			this.m_toggleKey[7].setSelected(false);
		}
	}

	public void syncKbdLED() {
		byte b = JViewerApp.getInstance().getHostKeyboardLEDStatus();

		if (this.clientKybdLED != b) {
			this.clientKybdLED = b;
			this.JDialogContentPane.setVisible(false);
			if ((this.clientKybdLED & 0x1) == 1) {
				this.m_toggleKey[10].setSelected(true);
				this.m_skmouselistener.OnNum(this.numpadkeyson);
			} else {
				this.m_toggleKey[10].setSelected(false);
				this.m_skmouselistener.OnNum(this.numpadkeysoff);
			}
			if ((this.clientKybdLED & 0x2) == 2) {
				this.m_toggleKey[1].setSelected(true);
				if ((this.m_toggleKey[2].isSelected() == true) || (this.m_toggleKey[9].isSelected() == true)) {
					this.m_skmouselistener.OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.shiftedCapsCharSet[lngindex]);
				} else
					this.m_skmouselistener.OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCapsCharSet[lngindex]);
				this.m_butKey[15].setText("pau");
			} else {
				this.m_toggleKey[1].setSelected(false);

				if ((this.m_toggleKey[2].isSelected() == true) || (this.m_toggleKey[9].isSelected() == true)) {
					this.m_skmouselistener.OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.shiftedCharSet[lngindex]);
				} else
					this.m_skmouselistener.OnCaps(com.ami.kvm.jviewer.hid.KeyProcessor.normalCharSet[lngindex]);
				this.m_butKey[15].setText("brk");
			}

			if ((this.clientKybdLED & 0x4) == 4) {
				this.m_toggleKey[0].setSelected(true);
			} else {
				this.m_toggleKey[0].setSelected(false);
			}
			this.JDialogContentPane.setVisible(true);
		}
	}

	public void OnUpdateKeyState(Boolean paramBoolean) {
		for (int i = 0; i < this.m_butKey.length; i++) {
			if (this.m_butKey[i] != null)
				this.m_butKey[i].setEnabled(paramBoolean.booleanValue());
			if (i < this.m_toggleKey.length) {
				if (this.m_toggleKey[i] != null)
					this.m_toggleKey[i].setEnabled(paramBoolean.booleanValue());
			}
			if (i < this.japSpecialKeys.length) {
				if (this.japSpecialKeys[i] != null) {
					this.japSpecialKeys[i].setEnabled(paramBoolean.booleanValue());
				}
			}
		}
	}
}

/*
 * Location:
 * D:\Users\tianlin\Downloads\JViewer.jar!\com\ami\kvm\jviewer\gui\SoftKeyboard.
 * class Java compiler version: 5 (49.0) JD-Core Version: 0.7.1
 */